﻿using System.Xml.Linq;
using Test1;

namespace Game
{
    public class DodoButtonsPanelWidget : CanvasWidget
    {
        public static string[] stringDodo = new string[5] { "渡渡可不是笨鸟!吾可是最聪明的鸟，渡渡是也！上知天文，下知地理，无所不知！有什么疑惑尽管问吾吧！哇哈哈哈！", "渡渡一出生就生活在血泪之池，什么？你问吾血泪之池是怎么来的？em……（转三圈）你知道【鸟转三圈就会遗忘】这句格言吗？就是这个道理，你还是别问了吧！哇哈哈哈", "你要小心血泪之池那些丧尸……他们的攻击是无视护甲和抗性的直接伤害，所以还是避让一下尸群吧！吾不记得什么时候血泪之池变成了这个样子……不对！血泪之池一直都是这个样子！对，没错！", "这个国家的人口有100亿6564万！国土有7000平方千米，总之就是非常广阔！总之就是非常巨大！", "咳咳……你找吾有什么事情吗？" };

        public static string[] stringDodoCity = new string[5] { "哦哦，好久不见啊，先生！（兴奋转三圈），你怎么也来到这里玩了？", "什么？洛德先生居然骂我是傻鸟！！呜……我待会一定要好好问问他！（不可置信）", "你问我为什么会在这里？洛德先生带我来到这的呀，他是个好人哟，温柔又儒雅，虽然人怪怪的，长得也奇怪。好吧，他其实长得像一个猫头鹰，硬要说，他和我一样是鸟呢！", "如果你累了，可以在洛德先生的安全区休息会。这里很安全的哟！", "这里的怪物相对血池，数量更加的多，而且更加暴躁。你务必要小心。尤其是那个尸鬼，他的攻击会导致你失明！" };

        public bool YHLZ = false;

        public bool BS = false;

        public ComponentTest1 m_componentTest1;

        public ComponentMiner m_componentMiner;

        public ComponentHealth m_componentHealth;

        private string entityname1 = "愚鸟渡渡";

        public ComponentTest1 componentTest1;

        public Random random = new Random();

        public ComponentPlayer m_componentPlayer;

        public SubsystemNPCBehavior m_subsystemNPCBehavior;

        public ComponentMoney m_componentMoney;

        public BevelledButtonWidget m_button6;

        public BevelledButtonWidget m_button7;

        public BevelledButtonWidget m_button8;

        public BevelledButtonWidget m_button9;

        public BevelledButtonWidget m_button10;

        public ComponentTask componentTask;

        public DodoButtonsPanelWidget(ComponentMiner componentMiner, SubsystemNPCBehavior subsystemNPCBehavior, ComponentMoney componentMoney, IInventory inventory, ComponentPlayer componentPlayer, ComponentHealth componentHealth)
        {
            m_componentMiner = componentMiner;
            m_subsystemNPCBehavior = subsystemNPCBehavior;
            m_componentMoney = componentMoney;
            m_componentHealth = componentHealth;
            m_componentPlayer = componentPlayer;
            componentTest1 = componentMiner.Entity.FindComponent<ComponentTest1>();
            componentTask = componentPlayer.Entity.FindComponent<ComponentTask>();
            XElement node = ContentManager.Get<XElement>("Talk/Widgets/DodoButtonsPanelWidget");
            LoadContents(this, node);
            m_button6 = Children.Find<BevelledButtonWidget>("Button6");
            m_button7 = Children.Find<BevelledButtonWidget>("Button7");
            m_button8 = Children.Find<BevelledButtonWidget>("Button8");
            m_button9 = Children.Find<BevelledButtonWidget>("Button9");
            m_button10 = Children.Find<BevelledButtonWidget>("Button10");
        }

        public override void Update()
        {
            if (m_button6.IsClicked)
            {
                int num = random.Int(0, 4);
                if (componentTest1.Areaname == "失落城市")
                {
                    componentTask.OpenText(stringDodoCity[num], entityname1);
                }
                else if (componentTest1.Areaname == "血泪之池")
                {
                    componentTask.OpenText(stringDodo[num], entityname1);
                }
            }

            if (m_button7.IsClicked)
            {
                m_componentPlayer.ComponentGui.ModalPanelWidget = new TradingWidget(m_componentMiner.Inventory, m_componentMoney, m_componentMiner.ComponentPlayer, m_componentHealth);
            }

            if (!m_button8.IsClicked)
            {
            }
        }
    }
}